﻿using MediatR;
using Traceability.Commont.Domains.BatchManagementFiles;
using Traceability.Commont.DTOs.CommontFiles;
using Traceability.Commont.Infrastructures.Interfaces;

namespace U.Enterprise.Api.Applications.BatchManagements
{
    public class StashsListHander : IRequestHandler<StashsListCommand, Resqults<Stash>>
    {
        private readonly IBateRepository<Stash> stash;

        public StashsListHander(IBateRepository<Stash> stash)
        {
            this.stash = stash;
        }

        public async Task<Resqults<Stash>> Handle(StashsListCommand request, CancellationToken cancellationToken)
        {
            try
            {
                var res = stash.GetAll().ToList();
                Resqults<Stash> resqults = new Resqults<Stash>();
                resqults.Date = res;
                return resqults;
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
